package com.sunyifeng.ch02;

/**
 * 测验2.2 匿名类谜题
 * 返回结果是5，因为this指向Runnable()
 */
public class MeaningOfThis {
    public final int value = 4;

    public void doIt() {
        int value = 6;
        Runnable r = new Runnable() { //匿名类
            public final int value = 5;

            public void run() {
                int value = 10;
                System.out.println(this.value);
            }
        };
        r.run();
    }

    // main方法
    public static void main(String... args) {
        MeaningOfThis m = new MeaningOfThis();
        m.doIt(); // ???
    }
}
